from core import data_model
from code.data_model.simple import Batch

class Batches(data_model.Batches):
    
    def __init__(self, data):
        self.__bdict = {} # Хранилище всех пачек
        self.__selected_batch = None # Текущая выделенная пачка
        self.__total_papers_count = None # Общее количество работ
        self.__data = data

    def add(self, number, papers_count):
        self.__bdict[number] = Batch(number, papers_count, data)
        self.__total_papers_count += papers_count

    def all(self):
        return self.__bdict.values()

    def find(self, number):
        return self.__bdict.get(bno, None)

    def setSelected(self, batch):
        self.__selected_batch = batch
    
    def selected(self):
        return self.__selected_batch
